/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Modelo;

import BaseDatos.Conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author JEANPIERE
 */
public class Profesor extends Persona{
  Connection cn;
    public Profesor() {
         Conexion con = new Conexion();
           cn = con.conectar();
    }
    
    
   
    
    
 public boolean ExamenEnCurso(){
     boolean resp = false;
      
      try
        {
            String sql = "SELECT * FROM examen WHERE codigoProfesor = ? AND activo=?";
            PreparedStatement cmd = cn.prepareStatement(sql);
            cmd.setString(1, this.getCodigo());
            cmd.setBoolean(2, true);
            ResultSet rs = cmd.executeQuery();
            if(rs.next())
            {
                resp = true;
               
            }
            cmd.close();
            
        }
        catch(Exception ex)
        {
            System.out.println("Error: " + ex.getMessage());
        }
     
     
     
     
     return resp;
     
     
 }
}
